#include "LogUtil.h"

#include "Logger.h"

namespace Utility
{
    namespace LoggerLib
    {
        
        CLogger logger;

        int InitLogger(unsigned long dwLevelMask, unsigned long dwExecutorMask, const wstring &strLogFilePath)
        {
            logger.Initialize(dwLevelMask, dwExecutorMask, strLogFilePath);
            return 0;
        }

        bool IsLogInitialized()
        {
            return logger.IsInitialized();
        }

        int Log(ELOGLEVEL eLevel, ELOGMODULE eModule, const wstring &strMessage)
        {
            logger.Log(eLevel, eModule, strMessage);
            return 0;
        }

        int Log(ELOGLEVEL level, ELOGMODULE eModule, wchar_t* strFormat, ...)
        {
            va_list va;
            va_start(va, strFormat);
            wchar_t szBuf[1024];
            ZeroMemory(szBuf, 1024);

            vswprintf_s(szBuf, strFormat, va);
            return Log(level, eModule, wstring(szBuf));
        }

    }
}